package com.maker.ai.service;

import com.maker.ai.entity.Reservation;
import com.maker.ai.mapper.ReservationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReservationService {
    @Autowired
    private ReservationMapper reservationMapper;
    //添加预约信息的方法
    public String insert(Reservation reservation) {
        reservationMapper.insert(reservation);
        return "预约成功";
    }
    //根据手机号，查询预约信息的方法
    public Reservation findByPhone(String phone) {
        return reservationMapper.findByPhone(phone);
    }

    //查询所有预约信息的方法
    public List<Reservation> getAllReservations() {
        return reservationMapper.getAllReservations();
    }

    public List<Reservation> findByName(String name) {
        return reservationMapper.findByName(name);
    }
}
